

function fun1(a,b):void{
    return a+b;
}
function fun2(a:number,b:number):number{
    return a+b;//返回类型一致
}
let r = fun1(10,20);
console.log(r);
// let r2 = fun2(10,'1');//报错
function fun3(a:number,b:string):string{
    return a+b;//返回类型一致
}